# -*- coding: utf-8 -*-
"""
Created on Tue Jul 14 10:59:59 2020

@author: 81283
"""

from bg_plot.bg_plot import anim_plot
from agent.agent import get_next_s


def goal_maze():
    s = 0  # 出发地点
    state_history = [0]  # 移动的历史记录

    while (1):  # 
        next_s = get_next_s(s)
        state_history.append(next_s)  # 

        if next_s == 8:  #
            break
        else:
            s = next_s

    return state_history

if __name__=="__main__":
    state_history = goal_maze() # 移动的历史记录
    anim_plot(state_history, 0)
    print("求解迷宫问题本次走的步数："+str(len(state_history)-1))
